﻿using Zenject;

namespace ProjectScript
{
    public class ProjectContextInstaller : MonoInstaller<ProjectContextInstaller>
    {
        public override void InstallBindings()
        {
            /*********************************** DataMapper&Service ************************************************/
            Container.Bind<RealmDataSource>().FromNewComponentOnNewGameObject().AsSingle().NonLazy();
            // 直接绑定 BaseMapper<Hero> 到 HeroMapper 并设为单例
            // HeroService 依赖会自动解析
            Container.Bind<BaseMapper<Role>>().To<RoleMapper>().AsSingle();
            Container.Bind<RoleService>().ToSelf().AsSingle();
            Container.Bind<BaseMapper<Weapon>>().To<WeaponMapper>().AsSingle();
            Container.Bind<WeaponService>().ToSelf().AsSingle();
            Container.Bind<BaseMapper<Difficulty>>().To<DifficultyMapper>().AsSingle();
            Container.Bind<DifficultyService>().ToSelf().AsSingle();

            /*********************************** Manager ************************************************/
            Container.Bind<GameManager>().FromNewComponentOnNewGameObject().AsSingle().NonLazy();
            Container.Bind<WaveManager>().FromNewComponentOnNewGameObject().AsSingle().NonLazy();
        }
    }
}